<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>大厅</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<link rel="stylesheet" type="text/css" href="../css/common.css">
	
	<script type='text/javascript'
		src='<%=request.getContextPath()%>/dwr/engine.js'></script>
	<script type='text/javascript'
		src='<%=request.getContextPath()%>/dwr/util.js'></script>
	<script type='text/javascript'
		src='<%=request.getContextPath()%>/js/jquery-latest.pack.js'></script>
	<script type='text/javascript'
		src='<%=request.getContextPath()%>/js/noConflictOfJquery.js'></script>
	<script type='text/javascript'
		src='<%=request.getContextPath()%>/dwr/interface/hallAction.js'></script>
	<script type='text/javascript'>
	//===============全局变量定义开始========
	//----------------全局变量定义结束------------
	//===============初始化开始========
		$j(function(){
			hallAction.getAllPersonInHall(getAllPersonInHallCallback);
			
		});
		var getAllPersonInHallCallback = function(halllist){
			for(var i=0;i<halllist.length;i++){
				hall = halllist[i];
				var hallItemHtml = "<tr onmouseover='onMouseOver(this)' onmouseout='onMouseOut(this)' onclick='showPersonInfo(this)' id='"+hall[2]+"'>"
						+"<td>"+hall[2]+"</td>"
						+"<td>"+hall[3]+"</td>"
						+"<td>"+"<input type='button' value='分配宿舍' onclick='allocateDorm("+hall[1]+")'/>"+"</td>"
						+"<td>"+"<input type='button' value='移出大厅' onclick='removeFromHall("+hall[1]+",this)'/>"+"</td>"
					+"</tr>" ;
				$j('#div_hall').append(hallItemHtml);
			}
		}
		
	//----------------初始化结束------------
	
	//===========自定义函数开始=======
	
	//跳转到分配宿舍
	function allocateDorm(personid){
		window.location = "../lodgemgr/allocateoneperson.jsp?personid="+personid;
	}
	//移出大厅
	function removeFromHall(hallid,obj){
		if(!confirm("确定移除?")){
			return ;
		}
		hallAction.deleteHallItem(hallid,function(message){
			if('success' != message){
				alert(message);
			}else{
				$j(obj).parent().remove();
			}
		});
	}
	//显示学生或人员的信息
	function showPersonInfo(obj){
		$('student_info').value = obj.id;
		stu_BasicInfo()	;
		
	}
	function onMouseOver(obj){
		obj.style.backgroundColor = "yellow";
	}
	function onMouseOut(obj){
		obj.style.backgroundColor = "";
	}
	
	
	//----------自定义函数结束---------
	</script>
  </head>
  
  <body>
  <table id="div_hall">
  </table>
  <jsp:include page="../allperson/basicstudentinfo.jsp" ></jsp:include>
  </body>
</html>
